
#ifndef HEM_COMMON_H
#define HEM_COMMON_H

#include <stdint.h>
#include "hem1601.h"

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MAX3(a, b, c) MAX(MAX(a, b), c)
#define MIN3(a, b, c) MIN(MIN(a, b), c)

typedef struct io 
{
#if HEM_AI_NUM > 0
  uint32_t ai[HEM_AI_NUM];
  uint32_t inmode[10];//0:0~5V;1:0~36V;2:4~20mA;4:DIH
#endif
#if HEM_DI_NUM > 0
  uint32_t di[HEM_DI_NUM];
#endif
#if HEM_PIF_NUM > 0
  uint32_t pi[HEM_PIF_NUM];
#endif
#if HEM_DO_NUM > 0
  uint32_t dout[HEM_DO_NUM];
#endif
#if HEM_DOL_NUM >0
  uint32_t dol_out[HEM_DOL_NUM];
#endif
#if HEM_DOL_NUM >0
  uint32_t Hbridge_out[HEM_DOL_NUM];
#endif
#if HEM_AO_NUM > 0
  uint32_t ao[HEM_AO_NUM];
#endif
#if HEM_PWM_NUM > 0
  uint32_t pwm[HEM_PWM_NUM];
#endif
#if HEM_PWMI_NUM > 0
  uint32_t pwmi[HEM_PWMI_NUM];
#endif
}io_t;











#endif

